package com.goldenautumn.prefabricate.activity.mine.adapter

import android.content.Context
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.DataBindingHolder
import com.goldenautumn.prefabricate.R
import com.goldenautumn.prefabricate.business.entity.ApplyRefundType
import com.goldenautumn.prefabricate.databinding.ItemApplyRefundBinding

class ApplyRefundAdapter : BaseQuickAdapter<ApplyRefundType, DataBindingHolder<ItemApplyRefundBinding>>() {

    var selectPosition = -1

    override fun onBindViewHolder(holder: DataBindingHolder<ItemApplyRefundBinding>, position: Int, item: ApplyRefundType?) {
        if(item == null) return
        var mBinding  = holder.binding

        mBinding.icon.setImageResource(if(selectPosition == position) R.mipmap.ic_address_select else R.mipmap.ic_address_not_select)
        mBinding.title.text = "${item.title}"

    }

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): DataBindingHolder<ItemApplyRefundBinding> {
        return DataBindingHolder(R.layout.item_apply_refund,parent)
    }

}